import App from './App'
import { setupI18n } from './locale/index'

// #ifdef VUE3
import { createSSRApp } from 'vue'
import * as util from './common/util'
import http from './common/http'
import {setPageTitle} from '@/common/util'

// 全局注册组件 @/components/no-item
import noItem from '@/components/no-item'
import loadingPage from '@/components/loading-page'

export function createApp() {
  const app = createSSRApp(App)
  setupI18n(app)
  app.component('no-item', noItem)
  app.component('loading-page', loadingPage)
  app.config.globalProperties.$util = util
  app.config.globalProperties.$http = http
  app.mixin({
    onLoad() {
      this.$nextTick(() => {
        setPageTitle()
      })
    }
  })
  return {
    app,
  }
}
// #endif